﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.IO;

namespace DevExpress.MailClient.Win.Controls.File_tabs.File_Viewers
{
    public partial class ucSgyViewer : PRO_DOCS.BLL.WIN.Templates.DevxPermissionUserControlTemplate
    {
        public ucSgyViewer()
        {
            InitializeComponent();
        }
        private string EXTENSION
        { get; set; }

        string DestinationFilePath
        { get; set; }

        private string _fILE_PATH;
        private string FILE_PATH
        {
            set
            {
                _fILE_PATH = value;
                FileInfo docfileInfo = new FileInfo(value);
                //1. copy to a temp place
                 DestinationFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), docfileInfo.Name + EXTENSION);
                if (!new FileInfo(DestinationFilePath).Exists)
                {
                    docfileInfo.CopyTo(DestinationFilePath, true);
                }
            }
            get { return _fILE_PATH; }
        }
        public ucSgyViewer(string filePath, string extention)
        {
            InitializeComponent();
            EXTENSION = extention;
            FILE_PATH = filePath;
        }

        private void bbiOpenSgyFile_ItemClick(object sender, XtraBars.ItemClickEventArgs e)
        {
            System.Diagnostics.Process.Start(DestinationFilePath);
        }
    }
}
